package com.nhncorp.pleiades.client;

import java.util.LinkedList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class QueueEventHandler implements LockEventHandler {
  
  public static final Log LOG = LogFactory.getLog(QueueEventHandler.class
      .getName());
  
  public LinkedList<LockEventData> eventQueue;
  
  public QueueEventHandler() {
    eventQueue = new LinkedList<LockEventData>(); 
  }
  
  
  public void addLockEventMonitor(LockEventMonitor monitor) {}

  
  public void contentsModified(LockEventData eventData) {
    LOG.debug("contentsModified : " + eventData);
    synchronized(eventQueue) {
      eventQueue.add(eventData);
    }
  }

  
  public void lockExpired(LockEventData eventData) {
    LOG.debug("lockExpired : " + eventData);
    synchronized(eventQueue) {
      eventQueue.add(eventData);
    }
  }

  
  public void masterFailover() {
    LOG.debug("masterFailOver");
  }

  
  public void nodeAdded(LockEventData eventData) {
    LOG.debug("nodeAdded : " + eventData);
    synchronized(eventQueue) {
      eventQueue.add(eventData);
    }
  }

  
  public void nodeModified(LockEventData eventData) {
    LOG.debug("nodeModified : " + eventData);
    synchronized(eventQueue) {
      eventQueue.add(eventData);
    }
  }

  
  public void nodeRemoved(LockEventData eventData) {
    LOG.debug("nodeRemoved : " + eventData);
    synchronized(eventQueue) {
      eventQueue.add(eventData);
    }
  }

  
  public void removeEventMonitor(LockEventMonitor monitor) {}

  
  public void sessionExpired() {}

  
  public void sessionSafe() {}

  
  public void sessionWarning() {}

  
  public void clientExpired(LockEventData eventData) {
    
  }


  public void clearLockEventMonitors() {
    throw new RuntimeException("NOT IMPLEMENTED");
  }

}
